<template>
	<view>
		<view class="cu-list menu" style="margin-top: 200px;">
			<view class="cu-item item-box">
				<view class="content text-center">
					<button type="primary" @click="getMessage">订阅</button>
				</view>
			</view>
		</view>
		<view style="text-align: center; margin-top: 20px;">
			订阅消息，同意一次可发送1条（微信小程序规定）
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			this.getMessage()
		},
		methods: {
			getMessage() {
				uni.requestSubscribeMessage({
					tmplIds: ["O4jfY8XU72PHA4K6OFzT0NPpfNo_N5XnFBpPMv2PfOE"], // 改成你的小程序订阅消息模板id
					success: () => {
						uni.showToast({
							title: "订阅成功,可接收1条推送消息",
							icon: "none"
						})
					}
				});
			},
		}
	}
</script>

<style>

</style>